/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.src.ptit.javatraining.huynh.btvn1;

import java.util.Scanner;

/**
 *
 * @author user
 */
public class Baitap2 {

    static long ucln(long a, long b) {
        while (a * b != 0) {
            if (a > b) {
                a = a - b;
            } else {
                b = b - a;
            }
        }
        return a + b;

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a, b;
        try {
            a = sc.nextLong();
            b = sc.nextLong();
            System.out.println("UCLN của " + a + " " + b + " là " + ucln(a, b));
        } catch (Exception e) {
            System.out.println("Moi nhap lai !");
        }
    }
}
